// import 'package:flutter_secure_storage/flutter_secure_storage.dart';

// import './data_sharing.dart';

/// IMPORTANT!!!
/// // Delete value
/// await storage.delete(key: key);
/// This code does NOT work until app restart.
/// THAT MEANS THE VALUE REMAINS BEFORE APP RESTART.
/// GIT ISSUE: https://github.com/mogol/flutter_secure_storage/issues/357
///
/// Maybe you plan to set the value to null before removing it.
/// Let me tell you. It does NOT work either.
///
/// USE WITH CATUION AND KEEP IT IN MIND!!!
///
/// A service to get/set secure data on local device.
/// Local device data access is slow. So we cached each data to boost performance.
class LocalSecureStorage {
  // static FlutterSecureStorage _secureStorage;

  // /// Checks if the local secure storage contains data with [key].
  // static Future<bool> containsKey(String key) async {
  //   return _getSecureStorage().containsKey(key: key);
  // }

  // /// Removes the data from local secure storage and cache by [key].
  // static Future<void> remove(String key) async {
  //   await _getSecureStorage().delete(key: key);
  //   DataSharing.remove(key: key);
  // }

  // /// Clears the data from local secure storage and cache.
  // static Future<void> removeAll() async {
  //   await _getSecureStorage().deleteAll();
  //   DataSharing.removeAll();
  // }

  // /// Gets the data by the [key]. If it is not cached yet then the data will be get from the local secure storage.
  // static Future<String> get(String key) async {
  //   if (DataSharing.get(key) == null) {
  //     final value = await _getSecureStorage().read(key: key);
  //     DataSharing.set<String>(key, value);
  //   }

  //   return DataSharing.get<String>(key);
  // }

  // /// Sets the data by the [key] and [value]. The cache is updated, too.
  // static Future<void> set(String key, String value) async {
  //   await _getSecureStorage().write(key: key, value: value);
  //   DataSharing.set<String>(key, value);
  // }

  // /// Gets the library class instance to interact with local secure storage.
  // static FlutterSecureStorage _getSecureStorage() {
  //   _secureStorage ??= const FlutterSecureStorage();

  //   return _secureStorage;
  // }
}
